package org.proxywars.engine.hud.valuebar;

import java.util.ArrayList;

import com.jme.renderer.ColorRGBA;

/**
 * This interface describes a ValueBarTextLayer.  
 * It is used to display all text on a value bar - min, max, current, percentage, string, or a range of strings.
 * 
 * @author Steven DeVries
 */
public interface InterfaceValueBarTextLayer extends InterfaceValueBarLayer {
    
    /* Constants */
    /** Type Constant:  used to set the current value's visibility and alignments. */
    int TYPE_CURRENT = 0;
    /** Type Constant:  used to set the max value's visibility and alignments. */
    int TYPE_MAX = 1;
    /** Type Constant:  used to set the min value's visibility and alignments. */
    int TYPE_MIN = 2;
    /** Type Constant:  used to set the percent's visibility and alignments. */
    int TYPE_PERCENT = 3;
    /** Type Constant:  used to set the text's  visibility and alignments. */
    int TYPE_TEXT = 4;
    
    /** Font Style Constant: used to make text plain. */
    int FONT_PLAIN = 0;
    /** Font Style Constant: used to make text bold. */
    int FONT_BOLD = 1;
    /** Font Style Constant: used to make text italicized. */
    int FONT_ITALIC = 2;    
    
    /* Set Methods */
    /**
     * Sets the alignment of all the text in the layer.
     * This has been deprecated since you should manually 
     * set the alignment of each visible element.
     * 
     * @param horizontal    Horizontal alignment constant.
     * @param vertical        Vertical alignment constant.
     */
    @Deprecated
    void setAlign(int horizontal, int vertical);
    
    /**
     * Sets the alignment of the text within the ValueBarLayer.
     * Each type of text can be set to a different alignments, 
     * to allow the viewing of all the different values.
     * 
     * @param alignHorizontal - an alignment constant: ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT. 
     * @param alignVertical - an alignment constant: ALIGN_CENTER, ALIGN_BOTTOM, or ALIGN_TOP. 
     * @param type -  a TYPE_* constant: 
     *      TYPE_CURRENT, TYPE_MAX, TYPE_MIN, TYPE_PERCENT, TYPE_TEXT.
     */
    void setAlign(int alignHorizontal, int alignVertical, int type);
    
    /**
     * Set the font to use.
     * TODO: not clue what parameters are needed here.
     */
    void setFont();
    
    /**
     * Sets the color of the font.
     * 
     * @param color color to set the font too.
     */
    void setFontColor(ColorRGBA color);
    
    /**
     * Sets the color range of the font.
     * Using the full/empty colors, the bar generates a color to paint itself with 
     * based on the current value of the bar.
     * 
     * @param emptyColor    color to display when bar is empty.
     * @param fullColor         color to display when bar is full.
     * @param numColors     number of colors between the full and empty color.
     */
    void setFontColorRange(ColorRGBA emptyColor, ColorRGBA fullColor, int numColors);
    
    /**
     * Sets the color range of the font.  For more information about how color ranges work
     * see the description of setColorRange.
     * 
     * @param colorArray    Array of colors starting with empty color, ending in full color.
     * @param numColors   the number of colors per transition.
     */
    void setFontColorRange(ArrayList<ColorRGBA> colorArray, int numColors);
    
    /**
     * Sets the font size of this layer to jmeUnits, which is essentially 12= 12pt.
     * 
     * @param fontSize      the size of the font.
     */
    void setFontSize(int fontSize);
    
    /**
     * Set the style of the font.
     * At this time this function is just a place holder - as Text2D does not have a setFlags function.
     * Until such a function exists, it'd be a pain to try and implement.
     * 
     * @param fontStyle     style constant: FONT_PLAIN, FONT_BOLD, FONT_ITALIC.
     */
    void setFontStyle(int fontStyle);
    
    /**
     * Set the number of places displayed by the bar's percentage.
     * (e.g. 88.07%  or 88%)
     * 
     * @param precision - the number of decimal places.
     */
    void setPrecision(int precision);
    
    /**
     * Sets a text string on the bar layer.
     * (e.g. Player or Creature name.)
     * 
     * @param text - A string to be displayed on the bar.
     */
    void setText(String text);
    
    /**
     * Sets an array of strings for the bar to display.
     * The selected string is based on the value of the bar.
     * (e.g. Healthy, Minor Injuries, Injured, Wounded, Badly Wounded, Dead.)
     * 
     * @param textValues - array of strings to display.
     */
    void setTextRange(ArrayList<String> textValues);
    
    /**
     * Set a type to visible or not, effectively hiding the information on the bar.
     * 
     * @param isVisible - boolean true or false.
     * @param type -  a TYPE_* constant: 
     *      TYPE_CURRENT, TYPE_MAX, TYPE_MIN, TYPE_PERCENT, TYPE_TEXT.  
     */
    void setVisible(boolean isVisible, int type);
}
